[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
  Function            valid_date - check if a date is valid

  Syntax              boolean valid_date(int month, int day,
                                         int yearnum);

  Prototype in        datehk.h

  Remarks             valid_date checks if the given date is valid.

  Return value        returns TRUE if the date is valid, FALSE otherwise.

  See also            isleapyear()

  Example             #include <datehk.h>

                      main()
                      {
                           int i, d[3] = { 11,5,2 }, m[3] = { 31,12,29};
                           int y[3] = { 70, 1987, 1981 };

                           for (i=0; i<3; ++) {
                                printf("%d/%d/%d  ", m[i], d[i], y[i]);
                                if (valid_date(m[i], d[i], y[i])
                                     printf("valid\n");
                                else
                                     printf("INVALID\n");
                           }
                      }

  Program output      11/31/70  INVALID        /* Nov has 30 days */
                      5/13/1987  valid
                      2/29/1981  INVALID       /* 1981 not a leap year */


See Also: isleapyear()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson